<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        li {
            width: 100px;
            height: 100px;
            text-align: center;
            line-height: 100px;
            position: absolute;
        }

        * {
            margin: 0px;
            padding: 0px;
        }

        ul {
            list-style: none;
            width: 100px;
            height: 100px;
            transform-style: preserve-3d;
            transition: 20s;

        }

        ul:hover {
            transform: rotate3d(1, 1, 1, 36000deg);
            transition: 20s;
            margin-left: 1000px;
            margin-top: 300px;

        }

        ul:hover li {

            transition: 3s;
        }


        .left {
            background-color: aqua;
            transform: rotateY(90deg) translateZ(-50px);
        }

        .right {
            background-color: blue;
            transform: rotateY(90deg) translateZ(50px);
        }

        .top {
            background-color: red;
            transform: rotateX(90deg) translateZ(50px);
        }

        .bottom {
            background-color: yellow;
            transform: rotateX(180deg) translateZ(50px);
        }

        .front {
            background-color: greenyellow;
            transform: rotateX(0deg) translateZ(50px);
        }

        .behind {
            background-color: green;
            transform: rotateX(270deg) translateZ(50px);
        }
    </style>
</head>

<body>
    <ul>
        <li class="left">1</li>
        <li class="right">2</li>
        <li class="top">3</li>
        <li class="bottom">4</li>
        <li class="front">5</li>
        <li class="behind">6</li>
    </ul>

</body>

</html>